/*
*  Copyright 2019-2023 Zheng Jie
*
*  Licensed under the Apache License, Version 2.0 (the "License");
*  you may not use this file except in compliance with the License.
*  You may obtain a copy of the License at
*
*  http://www.apache.org/licenses/LICENSE-2.0
*
*  Unless required by applicable law or agreed to in writing, software
*  distributed under the License is distributed on an "AS IS" BASIS,
*  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
*  See the License for the specific language governing permissions and
*  limitations under the License.
*/
package me.zhengjie.post.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
import cn.hutool.core.bean.BeanUtil;
import io.swagger.annotations.ApiModelProperty;
import cn.hutool.core.bean.copier.CopyOptions;
import java.sql.Timestamp;
import java.io.Serializable;
import java.util.List;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import me.zhengjie.poemmanager.domain.Comment;

/**
* @description /
* @author hwl
* @date 2024-12-06
**/
@Data
@TableName("post")
public class Post implements Serializable {

    @TableId(value = "post_id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Integer postId;


    @ApiModelProperty(value = "用户名")
    private String  userName;

    @ApiModelProperty(value = "诗歌id")
    private Integer poemId;
    @ApiModelProperty(value = "诗歌标题")
    private String poemTitle;
    @ApiModelProperty(value = "诗歌作者")
    private String poemAuthor;
    @ApiModelProperty(value = "标题")
    private String title;


    @ApiModelProperty(value = "主要内容")
    private String content;

    @ApiModelProperty(value = "创建时间")
    private Timestamp createdAt;

    @ApiModelProperty(value = "修改时间")
    private Timestamp updatedAt;

    @TableField(exist = false)
    @ApiModelProperty(value = "点赞数")
    private Integer userid;

    @ApiModelProperty(value = "状态（0正常，1删除）")
    private Integer status;
    @TableField(exist = false)
    @ApiModelProperty(value = "标签")
    private List<String> tag;
    @TableField(exist = false)
    @ApiModelProperty(value = "评论数")
    private Integer commentCount;
    @TableField(exist = false)
    @ApiModelProperty(value = "点赞数")
    private Integer likeCount;

    @TableField(exist = false)
    @ApiModelProperty(value = "评论数")
    private List<Comment> comments;
    @ApiModelProperty(value = "类型（0日常讨论贴，1诗歌解析贴）")
    private Integer type;
    @TableField(exist = false)
    @ApiModelProperty(value = "收藏数")
    private Integer favoriteCount;
    public void copy(Post source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
